<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home></home>
  </div>
  <script src="./vue.js"></script>
  <script>
    const Child = {
      template: `
        <div>
        
           <h2>我是子组件</h2>
           
           <slot name="a"></slot>
           <slot name="b"></slot>
        </div>
      `
    }
    const Home = {
      template:`
      <div>
        <child>
          <div slot="a">
            <button @click="fn">按钮</button>  
            <em>自定义内容</em>
          </div>  
          <div slot="b">
            <mark>哈哈哈哈</mark>  
            <b>自定义内容</b>
          </div> 
        </child>
      </div>
      `,
      methods:{
        fn(){
          alert(1)
        }
      },
      components: {
        Child
      }
    }

    Vue.component('Home', Home)
    const vm = new Vue({
      el: "#app"
    })
  </script>
</body>
</html>